package com.sunshine.androidjavapractise.pattern.singleton;

import android.content.Context;

public enum EnumSingleton {
    INSTANCE;
    private Context mContext;

    public void init(Context context) {
        mContext = context;
    }

    public String getString(int id) {
        checkContext();
        return mContext.getResources().getString(id);
    }

    private void checkContext() {
        if (null == mContext) {
            throw new RuntimeException("mContext must be init");
        }
    }

    public static EnumSingleton getInstance() {
        return INSTANCE;
    }
}
